package com.hk.web;

import com.hk.web.config.RedisPool;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;


@SpringBootApplication
@EnableDiscoveryClient
@EnableJpaAuditing
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
//        String env = System.getProperty("Env");
//        if (StringUtils.isEmpty(env)) {
//            System.out.println("Expected Env Param , please run with JVM option ,eg. -DEnv=local");
//            return;
//        }
        SpringApplication.run(Application.class, args);
    }

    @Value("${redis.pool.maxActive}")
    public void setPoolMaxActive(String poolMaxActive) {
        RedisPool.poolMaxActive = poolMaxActive;
    }
    @Value("${redis.pool.maxIdle}")
    public void setPoolMaxIdle(String poolMaxIdle) {
        RedisPool.poolMaxIdle = poolMaxIdle;
    }
    @Value("${redis.pool.maxWait}")
    public void setPoolMaxWait(String poolMaxWait) {
        RedisPool.poolMaxWait = poolMaxWait;
    }
    @Value("${redis.ip}")
    public void setIp1(String ip1) {
        RedisPool.ip1 = ip1;
    }
    @Value("${redis.port}")
    public void setPort1(String port1) {
        RedisPool.port = port1;
    }
    @Value("${redis1.ip}")
    public void setIp2(String ip2) {
        RedisPool.ip2 = ip2;
    }
    @Value("${redis1.ip}")
    public void setIp3(String ip3) {
        RedisPool.ip3 = ip3;
    }
}
